//package com.itheima.googleplay9.adapter;
//
//import android.text.format.Formatter;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.ImageView;
//import android.widget.RatingBar;
//import android.widget.TextView;
//
//import com.itheima.googleplay9.R;
//import com.itheima.googleplay9.bean.AppInfo;
//import com.itheima.googleplay9.global.GooglePlayApp;
//import com.itheima.googleplay9.holder.SubjectHolder;
//
//import java.util.ArrayList;
//
///**
// * Created by lxj on 2016/5/24.
// */
//public class HomeAdapterCopy extends BasicAdapter<AppInfo> {
//    public HomeAdapterCopy(ArrayList<AppInfo> list) {
//        super(list);
//    }
//
//    @Override
//    public View getView(int position, View convertView, ViewGroup parent) {
//        HomeHolder homeHolder = null;
//        SubjectHolder subjectHolder = null;
//        if (convertView == null) {
//            //1.创建Holder对象
//            //2.初始化控件
//            //3.设置tag
//            homeHolder = new HomeHolder();
//            subjectHolder = new SubjectHolder()；
//        }else {
//            //直接从tag取出holder
//            homeHolder = (HomeHolder) convertView.getTag();
//            subjectHolder = (SubjectHolder) convertView.getTag();
//        }
//
//        //获取数据
//        AppInfo appInfo = list.get(position);
//        //绑定数据
//       homeHolder.bindData(appInfo);
//        subjectHolder.bindData(appInfo);
//
//        //返回的时候就需要返回holder内部的convertView
//        return homeHolder.getHolderView();
//        return subjectHolder.getHolderView();
////        return convertView;
//    }
//
//    class HomeHolder{
//        TextView tv_name;
//        View convertView;
//        public HomeHolder(){
//            convertView = initHolderView();
//
//            //3.设置tag
//            convertView.setTag(homeHolder);
//        }
//
//        private View initHolderView() {
//            View view = View.inflate(GooglePlayApp.context, R.layout.adapter_home, null);
//            tv_name = ((TextView) view.findViewById(R.id.tv_name));
//            tv_size = ((TextView) view.findViewById(R.id.tv_size));
//            tv_des = ((TextView) view.findViewById(R.id.tv_des));
//            iv_icon = (ImageView) view.findViewById(R.id.iv_icon);
//            rb_star = (RatingBar) view.findViewById(R.id.rb_star);
//            return view;
//        }
//
//        public View getHolderView(){
//            return convertView;
//        }
//
//        public void bindData(AppInfo appInfo){
//            tv_name.setText(appInfo.getName());
//            tv_size.setText(Formatter.formatFileSize(GooglePlayApp.context,appInfo.getSize()));
//            tv_des.setText(appInfo.getDes());
//            rb_star.setRating(appInfo.getStars());
//        }
//    }
//}
